package demo.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import demo.filter.FilterDemo;
import demo.filter.OncePerRequestFilterDemo;

/**
 * 
 * @author hanjy
 *
 */
@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean aFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean(new OncePerRequestFilterDemo());
        registration.addUrlPatterns("/*");
        return registration;
    }

    @Bean
    public FilterRegistrationBean indexFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean(new FilterDemo());
        registration.addUrlPatterns("/*");
        return registration;
    }

}